cmake_minimum_required(VERSION 3.20)

project(SteelClient VERSION 1.0.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 查找Qt6组件
find_package(Qt6 REQUIRED COMPONENTS Core Widgets Charts)

# 设置Qt6的自动MOC、UIC、RCC
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

# 包含目录
include_directories(${CMAKE_SOURCE_DIR}/common)
include_directories(${CMAKE_SOURCE_DIR}/login)
include_directories(${CMAKE_SOURCE_DIR}/main)
include_directories(${CMAKE_SOURCE_DIR})

# 源文件
set(SOURCES
    SteelClientAPI.cpp
    MainWindow.cpp
    common/CommonContainer.cpp
    common/StyleManager.cpp
    common/TopbarWidget.cpp
    common/NavigationWidget.cpp
    common/ConfigItemWidget.cpp
    common/ProcessWidget.cpp
    common/GridTableWidget.cpp
    common/OxygenLanceWidget.cpp
    common/ChartWidget.cpp
    common/OperProcessWidget.cpp
    common/DebugWidget.cpp
    common/BlowingWidget.cpp
    common/VideoWidget.cpp
    common/CustomMessageBox.cpp
    login/LoginWidget.cpp
    main/MainPageWidget.cpp
    main/SmeltingConfigWidget.cpp
    main/MainOperationWidget.cpp
)

# 头文件
set(HEADERS
    SteelClientDataProvider.h
    MainWindow.h
    common/CommonContainer.h
    common/StyleManager.h
    common/TopbarWidget.h
    common/NavigationWidget.h
    common/ConfigItemWidget.h
    common/ProcessWidget.h
    common/GridTableWidget.h
    common/OxygenLanceWidget.h
    common/ChartWidget.h
    common/OperProcessWidget.h
    common/DebugWidget.h
    common/BlowingWidget.h
    common/VideoWidget.h
    common/CustomMessageBox.h
    login/LoginWidget.h
    main/MainPageWidget.h
    main/SmeltingConfigWidget.h
    main/MainOperationWidget.h
)

# UI文件
set(UI_FILES
    login/ui/LoginWidget.ui
)

# 资源文件
set(RESOURCES
    res/resources.qrc
)

# 创建动态库
add_library(${PROJECT_NAME} SHARED
    ${SOURCES}
    ${HEADERS}
    ${UI_FILES}
    ${RESOURCES}
)

# 链接Qt6库
target_link_libraries(${PROJECT_NAME}
    Qt6::Core
    Qt6::Widgets
    Qt6::Charts
)

# 设置输出目录
set_target_properties(${PROJECT_NAME} PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
    LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
    ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

# 设置导出符号
target_compile_definitions(${PROJECT_NAME} PRIVATE STEELCLIENT_EXPORTS)

# 添加示例程序子目录
add_subdirectory(example)
